<?php
namespace app\api\controller;
use think\Controller;
use app\admin\model\Admin as AdminModel;

class News extends Controller
{
    public function index($page=1)
    {	
		$each = 3;  //每页显示多少条
        @$dbtable = news;	//数据表名
    	$pages = new AdminModel();
        $res = $pages->page($page,$each,$dbtable);
        
    	if($res==-1 || $res== ''){
    		return ['code'=>400,'message'=>'没有此页面','data'=>$res];
    	}else{
            foreach ($res['list'] as $k => $v) {
                $res['list'][$k]['pic'] = $_SERVER['DOCUMENT_ROOT'] . $v['pic'];
            }
            return ['code'=>200,'message'=>'获取成功','data'=>$res];
        }
        
        
        
    }

}